//存放主要交互逻辑代码

var seckill = {
	URL:{
		
	},
	validatePhone:function(phone){
		if(phone && (phone.length == 11) && !isNaN(phone)){
			
		}else{
			return false;
		}
	},
	//详情页秒杀逻辑
	detail:{
		//详情页初始化
		init:function(params){
			//手机验证和登陆，计时交互
			//规划交互流程
			var killPhone = $.cookie('killPhone');
			var startTime = params['startTime'];
			var endTime = params['endTime'];
			var seckillId = params['seckillId'];
			//验证手机号
			if(!seckill.validatePhone(killPhone)){	//没有获取手机号
				//绑定phone
				var killPhoneModal = $('#killPhoneModal');
				killPhoneModal.modal({
					show:true,
					backdrop:'static',
					keyboard:false,
				});
				$('#killPhoneBtn').click(function(){
					var inputPhone = $('#killPhoneKey').val();
					if(seckill.validatePhone(inputPhone)){
						$.cookie('killPhone',inputPhone,{expires:7});
						location.reload();
					}else{
						$('#killPhoneMessage').hide().html('手机号码错误').show(300);
				});
			}
		}
	}
};
